package com.fujitsu.nanjing.tieba.dao;

import com.fujitsu.nanjing.tieba.ibator.CoreAttach;
import com.fujitsu.nanjing.tieba.ibator.CoreAttachCriteria;
import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class CoreAttachDAOImpl extends SqlMapClientDaoSupport implements CoreAttachDAO {

    public CoreAttachDAOImpl() {
        super();
    }

    public int countByExample(CoreAttachCriteria example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("core_attach.countByExample", example);
        return count;
    }

    public int deleteByExample(CoreAttachCriteria example) {
        int rows = getSqlMapClientTemplate().delete("core_attach.deleteByExample", example);
        return rows;
    }

    public int deleteByPrimaryKey(Integer attachid) {
        CoreAttach _key = new CoreAttach();
        _key.setAttachid(attachid);
        int rows = getSqlMapClientTemplate().delete("core_attach.deleteByPrimaryKey", _key);
        return rows;
    }

    public void insert(CoreAttach record) {
        getSqlMapClientTemplate().insert("core_attach.insert", record);
    }

    public void insertSelective(CoreAttach record) {
        getSqlMapClientTemplate().insert("core_attach.insertSelective", record);
    }

    @SuppressWarnings("unchecked")
    public List<CoreAttach> selectByExample(CoreAttachCriteria example) {
        List<CoreAttach> list = getSqlMapClientTemplate().queryForList("core_attach.selectByExample", example);
        return list;
    }

    public CoreAttach selectByPrimaryKey(Integer attachid) {
        CoreAttach _key = new CoreAttach();
        _key.setAttachid(attachid);
        CoreAttach record = (CoreAttach) getSqlMapClientTemplate().queryForObject("core_attach.selectByPrimaryKey", _key);
        return record;
    }

    public int updateByExampleSelective(CoreAttach record, CoreAttachCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_attach.updateByExampleSelective", parms);
        return rows;
    }

    public int updateByExample(CoreAttach record, CoreAttachCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_attach.updateByExample", parms);
        return rows;
    }

    public int updateByPrimaryKeySelective(CoreAttach record) {
        int rows = getSqlMapClientTemplate().update("core_attach.updateByPrimaryKeySelective", record);
        return rows;
    }

    public int updateByPrimaryKey(CoreAttach record) {
        int rows = getSqlMapClientTemplate().update("core_attach.updateByPrimaryKey", record);
        return rows;
    }

    protected static class UpdateByExampleParms extends CoreAttachCriteria {
        private Object record;

        public UpdateByExampleParms(Object record, CoreAttachCriteria example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
}